package org.aileen.springmvc.Controller;

import org.springframework.web.bind.annotation.*;

@RequestMapping("/hello/Aileen")//修改接口定义一定要告诉调用方
@RestController
public class HelloController {
    @RequestMapping ("/hello/java")
    public String hello() {
        return "Hello Spring MVC";
    }

    //仅支持 Get 和 Post请求
    @RequestMapping (value = "/hello2", method = {RequestMethod.GET, RequestMethod.POST})
    public String hello2() {
        return "Hello Spring MVC";
    }

    //仅支持get请求
    @GetMapping(value = "/hello3" )
    public String hello3() {
        return "Hello Spring MVC 3";
    }

//    //仅支持get请求
//    @GetMapping(value = "/hello3" )
//    public String hello5() {
//        return "Hello Spring MVC 5";
//    }

    //仅支持post请求
    @PostMapping("/hello3")
    public String hello4() {
        return "Hello Spring MVC 4";
    }
}
